package com.ruoyi.cs.service.impl;


import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.cs.domain.Banner;
import com.ruoyi.cs.mapper.BannerMapper;
import com.ruoyi.cs.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@SuppressWarnings("ALL")
public class BannerServiceImpl implements BannerService {
    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public void createBanner(Banner banner) {
        banner.setCreateTime(DateUtils.getNowDate());
        bannerMapper.insertBanner(banner);
    }

    @Override
    public void updateBanner(Banner banner) {
        banner.setUpdateTime(DateUtils.getNowDate());
        bannerMapper.updateBanner(banner);
    }

    @Override
    public void deleteBannerById(Long id) {
        bannerMapper.deleteBannerById(id);
    }

    @Override
    public Banner findBannerById(Long id) {
        return bannerMapper.findBannerById(id);
    }

    @Override
    public List<Banner> findAllBanners() {
        return bannerMapper.findAllBanners();
    }
}
